import {BasicColumn, FormSchema} from '@apps/antd-admin/src/components/Table';
import {RenderType} from '@pkg/setting';

export const columns: BasicColumn[] = [
  {
    title: '业务员',
    dataIndex: 'appUserName',
    width: 150,
  },
  {
    title: '承租人姓名',
    dataIndex: 'userName',
    width: 150,
  },
  {
    title: '身份证号',
    dataIndex: 'cardNo',
    ellipsis:true,
    width: 150,
  },
  {
    title: '手机号',
    dataIndex: 'mobile',
    width: 200,
  },
  {
    title: '婚姻状况',
    dataIndex: 'marriage',
    width: 150,
  },
  {
    title: '家庭人数',
    dataIndex: 'familySize',
    width: 150,
  },
  {
    title: '户籍地址',
    dataIndex: 'residenceAddress',
    width: 150,
  },
  {
    title: '现居住地址',
    dataIndex: 'address',
    ellipsis:true,
    width: 150,
  },
  {
    title: '单位名称',
    dataIndex: 'companyName',
    ellipsis:true,
    width: 150,
  },
  {
    title: '单位地址',
    dataIndex: 'companyAddress',
    ellipsis:true,
    width: 150,
  },
  {
    title: '职务',
    dataIndex: 'post',
    width: 150,
  },
  {
    title: '工作收入',
    dataIndex: 'income',
    width: 150,
  },
  {
    title: '电子邮箱',
    dataIndex: 'email',
    width: 150,
  },
  {
    title: '配偶姓名',
    dataIndex: 'linkMan1',
    width: 150,
  },
  {
    title: '配偶电话',
    dataIndex: 'mobile1',
    width: 150,
  },
  {
    title: '父母姓名',
    dataIndex: 'linkMan2',
    width: 150,
  },
  {
    title: '父母电话',
    dataIndex: 'mobile2',
    width: 150,
  },
  {
    title: '亲戚姓名',
    dataIndex: 'linkMan3',
    width: 150,
  },
  {
    title: '亲戚电话',
    dataIndex: 'mobile3',
    width: 150,
  },
  {
    title: '朋友姓名',
    dataIndex: 'linkMan4',
    width: 150,
  },
  {
    title: '朋友电话',
    dataIndex: 'mobile4',
    width: 150,
  },
  {
    title: '创建时间',
    dataIndex: 'createTime',
    width: 150,
  },
  {
    title: '备注',
    dataIndex: 'refundDesc',
    width: 150,
  },
  {
    title: '状态',
    dataIndex: 'status',
    width: 150,
    fixed: 'right',
    dictData: [
      {label: '未审核', value: 1},
      {label: '已审核', value: 2},
      {label: '已驳回', value: 3}
    ],
    renderType: RenderType.DICT,
  },

];

export const searchFormSchema: FormSchema[] = [
  {
    field: 'nickName',
    label: '业务员',
    component: 'Input',
    colProps: {span: 3},
  },
  {
    field: 'userName',
    label: '客户姓名',
    component: 'Input',
    colProps: {span: 3},
  },
  {
    field: 'cardNo',
    label: '身份证',
    component: 'Input',
    colProps: {span: 3},
  },
  {
    field: 'mobile',
    label: '手机号码',
    component: 'Input',
    colProps: {span: 3},
  },
  {
    field: 'status',
    label: '审核状态',
    component: 'Select',
    colProps: {span: 3},
    componentProps:{
      options: [
        { label: '未审批', value: 1 },
        { label: '已审批', value: 2 },
        { label: '已驳回', value: 3 }
      ],
    }
  }
];

export const formSchema: FormSchema[] = [
  {
    label: '所属业务员',
    field: 'userId',
    component: 'Input',
    required: true,
  },
  {
    label: '承租人姓名',
    field: 'userName',
    component: 'Input',
    required: true,
  },
  {
    label: '身份证号',
    field: 'cardNo',
    component: 'Input',
    required: true,
  },
  {
    label: '手机号',
    field: 'mobile',
    component: 'Input',
    required: true,
  },
  {
    label: '婚姻状况',
    field: 'marriage',
    component: 'Input',
    required: true,
  },
  {
    label: '家庭人数',
    field: 'familySize',
    component: 'Input',
    required: true,
  },
  {
    label: '户籍地址',
    field: 'residenceAddress',
    component: 'Input',
    required: true,
  },
  {
    label: '现居住地址',
    field: 'address',
    component: 'Input',
    required: true,
  },
  {
    label: '单位名称',
    field: 'companyName',
    component: 'Input',
    required: true,
  },
  {
    label: '单位地址',
    field: 'companyAddress',
    component: 'Input',
    required: true,
  },
  {
    label: '职务',
    field: 'post',
    component: 'Input',
    required: true,
  },
  {
    label: '工作收入',
    field: 'income',
    component: 'Input',
    required: true,
  },
  {
    label: '电子邮箱',
    field: 'email',
    component: 'Input',
    required: true,
  },
  {
    label: '配偶姓名',
    field: 'linkMan1',
    component: 'Input',
    required: true,
  },
  {
    label: '配偶电话',
    field: 'mobile1',
    component: 'Input',
    required: true,
  },
  {
    label: '父母姓名',
    field: 'linkMan2',
    component: 'Input',
    required: true,
  },
  {
    label: '父母电话',
    field: 'mobile2',
    component: 'Input',
    required: true,
  },
  {
    label: '亲戚姓名',
    field: 'linkMan3',
    component: 'Input'
  },
  {
    label: '亲戚电话',
    field: 'mobile3',
    component: 'Input'
  },
  {
    label: '朋友姓名',
    field: 'linkMan4',
    component: 'Input'
  },
  {
    label: '朋友电话',
    field: 'mobile4',
    component: 'Input'
  },
  {
    label: '签名',
    field: 'sign',
    component: 'ImageUpload',
    required: true,
  },{
    label: '审批状态',
    field: 'status',
    component: 'RadioButtonGroup',
    required: true,
    defaultValue: 2,
    componentProps: ({formModel, formActionType}) => {
      return {
        options: [
          {label: '通过', value: 2},
          {label: '驳回', value: 3},
        ],
        onChange: (val) => {
          if (val == 2) {
            formModel.refundDesc = "审批通过!";
          }
          if (val == 1) {
            formModel.refundDesc = " ";
          }
          if (val == 3) {
            formModel.refundDesc = "资料不符,请重新修改后提交";
          }
        }
      }
    },
  }, {
    label: '审批意见',
    field: 'refundDesc',
    component: 'InputTextArea',
    show: ({model}) => {
      if (model.status == 3) {
        return true;
      } else {
        return false;
      }
    },
  }
];
